package com.harper;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


/**
 * 微服务集成Sentinel
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients // 开启Feign功能
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    @Bean
    @LoadBalanced  // 添加此注解，可开启负载均衡策略
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

}